<?php

namespace app\admin\model\booking;

use think\Model;


class OrderGoods extends Model
{

    // 表名
    protected $name = 'booking_order_goods';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'image_text'
    ];

    public function getImageTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['image']) ? $data['image'] : '');
        return cdnurl($value, true);
    }

    public function Goods()
    {
        return $this->hasOne('Goods', 'id', 'goods_id');
    }

}
